home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / Conversion / Convert_RTF / Source / NeXTToMacRTFText.m < prev    next >
Text File  |  1993-04-04  |  3KB  |  80 lines

  1. /*====================================================================
  2. NOTE: You may find that text doesn't line up properly unless you use the New Century Schoolbook Roman typeface, since this was created with it.
  3.  
  4. INFORMATION:
  5.     This is $Revision: 1.5 $ of this file
  6.     It was last modified by $Author: death $ on $Date: 93/04/04 23:28:11 $
  7.      $Log:    NeXTToMacRTFText.m,v $
  8. Revision 1.5  93/04/04  23:28:11  death
  9. Sun Apr  4 23:28:11 PDT 1993
  10.  
  11. Revision 1.4  93/02/21  11:59:53  death
  12. Sun Feb 21 11:59:53 PST 1993
  13.  
  14. Revision 1.3  93/01/10  08:27:20  death
  15. Sun Jan 10 08:27:20 PST 1993
  16.  
  17. Revision 1.2  93/01/02  23:41:30  death
  18. Sat Jan  2 23:41:30 PST 1993
  19.  
  20. Revision 1.1  93/01/02  13:38:59  death
  21. Sat Jan  2 13:38:59 PST 1993
  22.  
  23. Revision 1.1  92/12/13  10:01:01  death
  24. Sun Dec 13 10:01:00 PST 1992
  25. ====================================================================*/
  26.  
  27. #import "NeXTToMacRTFText.h"
  28.  
  29. @implementation NeXTToMacRTFText
  30.  
  31.  
  32. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  33. //    Routine:        ConvertCharacter:
  34. //    Parameters:    a character to be converted
  35. //    Returns:        the converted character
  36. //    Stores:        the character that we are returning.
  37. //    Description:
  38. //        This uses the ConvertArray set up in the initialization to convert
  39. //        a character from a NeXT form to a Macintosh form.  Unlike the Mac rtf
  40. //        converter, if we get a nullcharacter back, we don't have the ability to use
  41. //        symbol instead.  As a result, there are a fair number of characters this will
  42. //        not be able to convert, and it will just return them as themselves.
  43. //        Note, we return a value in SECOND_RESULT concerning Symbol font usage.
  44. //        This is to maintain an identical interface with MacToNeXTRTFText, and not
  45. //        because we do anything with it.
  46. //    Bugs:
  47. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  48. - (Character) ConvertCharacter: (Character) theCharacter
  49. {
  50.     Character    result;
  51.     Boolean        couldconvert = YES;
  52.     [self ResetResults];
  53.  
  54.     //
  55.     //    In general, look up our result in the conversion array.  if we get a
  56.     //    null back (and we don't didn't pass a null), indicate we could not convet properly.
  57.     //
  58.     result = ConvertArray[theCharacter];
  59.     if ((result == NullCharacter) &&  (theCharacter != NullCharacter))
  60.     {
  61.         couldconvert = NO;
  62.         result = theCharacter;
  63.     }
  64.     //
  65.     //    Store the result, and return.  Put NO into the second result, showing that
  66.     //    we did not/could not invoke the use of symbol to allow the char to be converted.
  67.     //
  68.     [self      PutCharacter: result Into: FIRST_RESULT];
  69.     [self      PutBoolean: NO Into: SECOND_RESULT];
  70.  
  71.     if (couldconvert == YES)
  72.         [self    StoreErrorCode: errOK AndText: "Character converted!"];
  73.     else
  74.         [self    StoreErrorCode: errCANTMAPTOONE
  75.             AndText: "No equivalent standard Macintosh character"];
  76.     return result;
  77. }
  78.  
  79. @end
  80.